/******************* 公共变量 *******************/
var inviteObj = core.ls('inviteObj', 'o') || {},
	contactType = core.getUrlData('contact'),
	shouId = core.getUrlData('shou_id');

/******************* 页面数据载入 *******************/


/******************* 选择联系人 *******************/
core.addSelection({
	ele: 'html body .wrap .user-choose-contact section ul li',
	event: 'tap',
	multiple: true
},
function($this, index) {
	
});

/******************* 点击返回上一页前运行 *******************/
common.beforeBack = function () {
	// core.setCookie('inveteTheme=');
	// core.setCookie('inveteDrink=');
	// core.ls(inviteObj, 'o');
}

/******************* 点击返回上一页前运行 *******************/
var vm = new Vue({
	el: '.wrap',
	data: {
		contactType: contactType,
		focusUrl: (contactType ? (fansUrl + '?contact=follow&shou_id=' + shouId) : (contactUrl + '?contact=follow')),
		fansUrl:  (contactType ? (fansUrl + '?contact=fans&shou_id=' + shouId) : (contactUrl + '?contact=fans')),
		focusNum: '已关注',
		fansNum: '粉丝',
		contactNum: '玩伴',
		contactUrl: contactUrl + '?contact=contact&shou_id=' + shouId
	},
	methods: {
		
	},
	computed: {
		
	},
	components: {
		
	},
	created: function () {
		var _this = this;
		$.ajax({
			url: getFollow,
			type: 'post',
			// data: {user_id: '1'},
			success: function (data) {
				console.log(data)
				_this.focusNum = '已关注（' + data.total + '）'
			}
		});
		$.ajax({
			url: getFans,
			type: 'post',
			// data: {user_id: '1'},
			success: function (data) {
				console.log(data)
				_this.fansNum = '粉丝（' + data.total + '）'
			}
		});
		if (this.contactType) {
			$.ajax({
				url: contactListUrl,
				type: 'post',
				data: {user_id: shouId},
				success: function (data) {
					console.log(data)
					
					_this.contactNum = '玩伴（' + data.total + '）'
				}
			});
		}
	},
	mounted: function () {
		/******************* 点击全选按钮 *******************/
		core.addSelection({
			ele: 'html body .wrap .user-choose-contact section header div strong',
			event: 'tap',
			multiple: true
		},
		function($this, index) {
			$this.hasClass('active') ? $('html body .wrap .user-choose-contact section ul li').addClass('active') : $('html body .wrap .user-choose-contact section ul li').removeClass('active');
		});

	},
	updated: function () {
		
	}
});
